home *** CD-ROM | disk | FTP | other *** search
- /* testowanie device SANA II */
- #include <proto/exec.h>
- #include <stdio.h>
- #include <devices/sana2.h>
- #include <string.h>
-
- __asm __saveds ULONG CopyFromBuffProc(register __a0 void * to, register __a1 * from,
- register __d0 ULONG n)
- {
- memcpy(from, to, n);
- return n;
- }
-
- __asm __saveds ULONG CopyToBuffProc(register __a0 void * to, register __a1 * from,
- register __d0 ULONG n)
- {
- memcpy(from, to, n);
- return n;
- }
-
- int main(int argc, char * argv[])
- {
- struct MsgPort * mp = NULL;
- struct IOSana2Req * req = NULL;
- int error;
-
- ULONG TAG_LIST[] = { S2_CopyToBuff, CopyToBuffProc,
- S2_CopyFromBuff, CopyFromBuffProc,
- TAG_DONE, 0 };
-
- mp = CreateMsgPort();
- if (mp)
- {
- printf("MsgPort OK !!\n");
- req = (struct IOSana2Req *)CreateExtIO(mp, sizeof(struct IOSana2Req));
- if (req)
- {
- printf("IO request OK!!!\n");
- req->ios2_BufferManagement = TAG_LIST;
- error = OpenDevice("pcinet.device", 0, (struct IORequest *)req, 0);
- if (error == 0)
- {
- printf("Device OK!!\n");
- CloseDevice((struct IORequest *)req);
- }
- else
- printf("Open device failed %d!!\n", error);
- DeleteExtIO((struct IORequest *)req);
- }
- else
- printf("CreateExtIO failed!!\n");
- DeleteMsgPort(mp);
- }
- else
- printf("Create MsgPort failed !!\n");
- }
-